package com.wngz.school.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wngz.school.dto.ResponseResult;
import com.wngz.school.entity.Stu;
import com.wngz.school.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/stu")
public class stuController {
    @Autowired
    private StudentService studentService;

    @GetMapping("/query/{pageNumber}/{pageSize}")
    public ResponseResult query(@PathVariable Integer pageNumber,
                                @PathVariable Integer pageSize,
                                @RequestParam Map<String, Object> params) {
        Page<Stu> pageInfo = studentService.query(pageNumber, pageSize, params);
        return ResponseResult.success(pageInfo);
    }

    @GetMapping("/list")
    public ResponseResult list() {
        return ResponseResult.success(studentService.list());
    }
}
